// 创建Vue-router对象
import {createRouter, createWebHistory} from "vue-router";
import Index from "@/component/index.vue";
import Login from "@/component/login/login.vue";
import System from "@/component/System.vue";
import AdManagement from "@/component/AdManagement.vue";
import Portal from "@/views/systemVue/catalog/Portal.vue";
import Activity from "@/views/systemVue/sub-route/Activity.vue";
import User from "@/views/systemVue/sub-route/User.vue";
import userInfo from "@/component/userInfo.vue";
import ArticleEditor from "@/component/ArticleEditor.vue";
import PwdLogin from "@/component/login/pwdLogin.vue";
import EmailLogin from "@/component/login/emailLogin.vue";
import Register from "@/component/login/register.vue";
import UserBan from "@/views/systemVue/sub-route/UserBan.vue";
import ResetPassword from "@/component/login/resetPassword.vue";
import MyHomePage from "@/component/MyHomePage.vue";
import GoodsManagement from "@/views/systemVue/sub-route/GoodsManagement.vue"
import PointsCenter from "@/component/PointsCenter.vue"
import level from "@/component/level.vue"
import PointsMall from "@/component/PointsMall.vue";
import Article from "@/component/Article.vue";
import ArticleDto from "@/views/systemVue/sub-route/ArticleDto.vue";
import ArticleDtoBan from "@/views/systemVue/sub-route/ArticleDtoBan.vue";
import Search from "@/component/search.vue";

const router = createRouter({
    history: createWebHistory(),
    routes: [
        {
            path: "/",
            component: Index,
            name: Index,
            children: []
        },
        //登录页
        {
            path: "/login", name: Login, component: Login, redirect: "/pwdLogin",
            children: [
                {path: "/pwdLogin", name: PwdLogin, component: PwdLogin},
                {path: "/emailLogin", name: EmailLogin, component: EmailLogin},
                {path: "/register", name: Register, component: Register},
                {path: "/resetPassword", name: ResetPassword, component: ResetPassword}
            ]
        },
        // 后台页
        {
            path: '/system', name: System, component: System,
            children: [
                {path: 'Portal', name: "Portal", component: Portal,},
                {path: 'Activity', name: "Activity", component: Activity},
                {path: 'ArticleDto', name: "ArticleDto", component: ArticleDto,},
                {path: 'User', name: "User", component: User},
                {path: 'UserBan', name: 'UserBan', component: UserBan,},
                {path: 'ArticleDtoBan', name: 'ArticleDtoBan', component: ArticleDtoBan,},
                // 添加商品管理子路由
                {path: 'GoodsManagement', name: 'GoodsManagement',component: GoodsManagement,}
            ]
        },
        //广告页
        {path: "/adManagement", name: AdManagement, component: AdManagement},
        //我的主页
        {path: "/MyHomePage", name: MyHomePage, component: MyHomePage},
        //个人中心
        {
            path: "/userInfo",
            name: "userInfo",
            component: userInfo,
            children: [
                {path: "points", name: "PointsCenter", component: PointsCenter},
                {path: "level", name: "level", component: level},
                {path: "mall", name: "PointsMall", component: PointsMall}
            ]
        },
        //文章详情页
        {path: "/article/:articleId", component: Article, name: 'article', props: true},
        //文章编辑页面
        {path: "/articleEditor", component: ArticleEditor, name: ArticleEditor},
        // 运营端商品管理页面路径
        {path: '/goodsManagement', component: GoodsManagement, name: GoodsManagement},
        //搜索结果页面
        {path: "/search", name: Search, component: Search},
    ]
});

export default router;